<!DOCTYPE html>
<html>

<head>
    <title>WebSockets Demonstrator For LFY</title>
</head>

<body style="font-family: Lekton; font-size: 24pt">
    <p style="width: 800px">日志测试数据</p>
    <!-- <div id="textDiv"></div> -->

    <form action="/ws/mylog">

        <!--<input type="hidden" name="text1" value="logfile" />-->

        <!--<input type="submit" value="点击" />-->

    </form>



    <div id="textDiv"></div>


    <script type="text/javascript">
        if (window.location.protocol == 'https:') {
            var protocol = 'wss://';
        } else {
            var protocol = 'ws://';
        }
        var mylogurl =  protocol+document.URL.match(RegExp('//(.*?)/'))[1] + '/ws/mylog' + document.URL.match(/\?.*/)
        var ws = new WebSocket(mylogurl);

        ws.onopen = function() {
            ws.send("Hello, world");
        };
        ws.onmessage = function(evt) {

            console.log(evt.data)
            document.getElementById('textDiv').innerHTML = evt.data;



        };
    </script>

</body>


</html>
